﻿using System;
using System.Collections.Generic;

namespace SwyishChess.Domain.Piece
{
    public class Knight : ChessPiece, IMovable
    {
        public Knight(int owningPlayerId)
        {
            OwningPlayerId = owningPlayerId;
        }

        /* KNIGHT SPECIFIC MOVES */
        public int[,] GetPossibleMoves()
        {
            int[,] possibleMoves = new int[8, 2];

            possibleMoves[0, 0] = -1;
            possibleMoves[0, 1] = -2;
            possibleMoves[1, 0] = -2;
            possibleMoves[1, 1] = -1;
            possibleMoves[2, 0] = -2;
            possibleMoves[2, 1] = 1;
            possibleMoves[3, 0] = -1;
            possibleMoves[3, 1] = 2;

            possibleMoves[4, 0] = 1;
            possibleMoves[4, 1] = -2;
            possibleMoves[5, 0] = 2;
            possibleMoves[5, 1] = -1;
            possibleMoves[6, 0] = 1;
            possibleMoves[6, 1] = 2;
            possibleMoves[7, 0] = 2;
            possibleMoves[7, 1] = 1;


            return possibleMoves;
        }

        /* FINDS AND RETURNS ALL THE MOVES POSSIBLE BY THIS CHESS PIECE */
        public override List<int[,]> AllPossibleMoves
        {
            get
            {
                List<int[,]> possibleMoves = new List<int[,]>();
                possibleMoves.Add(GetPossibleMoves());
                return possibleMoves;
            }
        }

        public override string ToString()
        {
            return "Knight";
        }
    }
}
